using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ToolbarMap : EntityTypeConfiguration<so_Toolbar>
    {
        public so_ToolbarMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Project, t.Object, t.CommandTitle, t.Command, t.Icon, t.Hint, t.GroupOrder, t.ItemOrder, t.Group, t.Options, t.SecurityCode, t.ID });

            // Properties
            this.Property(t => t.Project)
                .IsRequired()
                .HasMaxLength(46);

            this.Property(t => t.Object)
                .IsRequired()
                .HasMaxLength(39);

            this.Property(t => t.CommandTitle)
                .IsRequired()
                .HasMaxLength(47);

            this.Property(t => t.Command)
                .IsRequired()
                .HasMaxLength(45);

            this.Property(t => t.Icon)
                .IsRequired()
                .HasMaxLength(39);

            this.Property(t => t.Hint)
                .IsRequired()
                .HasMaxLength(48);

            this.Property(t => t.GroupOrder)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.ItemOrder)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Group)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.Options)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.SecurityCode)
                .IsRequired()
                .HasMaxLength(32);

            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("so_Toolbar");
            this.Property(t => t.Project).HasColumnName("Project");
            this.Property(t => t.Object).HasColumnName("Object");
            this.Property(t => t.CommandTitle).HasColumnName("CommandTitle");
            this.Property(t => t.Command).HasColumnName("Command");
            this.Property(t => t.Icon).HasColumnName("Icon");
            this.Property(t => t.Hint).HasColumnName("Hint");
            this.Property(t => t.GroupOrder).HasColumnName("GroupOrder");
            this.Property(t => t.ItemOrder).HasColumnName("ItemOrder");
            this.Property(t => t.Group).HasColumnName("Group");
            this.Property(t => t.Options).HasColumnName("Options");
            this.Property(t => t.SecurityCode).HasColumnName("SecurityCode");
            this.Property(t => t.ID).HasColumnName("ID");
        }
    }
}
